var baseUrl='/weixin/'

//相关业务逻辑
$(function(){
	//清除session缓存里的数据
	window.sessionStorage.clear();
	page.bind();
	page.setLoginValue();
});

var page={//页面总变量
		bind:function(){
			$("#login").bind("click",function(){
				var userName=$("#username").val();
				var password=$("#password").val();
				var companyName=$("#companyName").val();
				if(userName==""){
					layAlert("请输入账号");
					return false;
				}
				if(password==""){
					layAlert("请输入密码");
					return false;
				}
				if(companyName==""){
					layAlert("请输入公司名称");
					return false;
				}
				window.localStorage.setItem('coustomCompanyName',companyName);
				window.localStorage.setItem('coustomUserName',userName);
				var sendDate={
						'coustomCompanyName':companyName,
						'coustomUserName':userName,
						'coustomPassword':password,
						'isLogin':true
				}
				ajaxUtil.ajaxRuquest(baseUrl+"thirdPartyView/login",sendDate,function(data){
					window.localStorage.setItem('customName', data.customerName);
					window.localStorage.setItem('customCompany', data.company);
					location.href ="thirdPartyViewIndex.html";
				});
			});
			$("#reset").bind("click",function(){
				$("#companyName").val("");
				$("#username").val("");
				$("#password").val("");
			});
			
		},
		setLoginValue:function(){
			$("#companyName").val(window.localStorage.getItem('coustomCompanyName'));
			$("#username").val(window.localStorage.getItem('coustomUserName'));
		}
}

